/*
 *   Copyright (c) 2011 Hitachi Data Systems, Inc.
 *
 *   Permission is hereby granted to  this software and associated
 *   documentation files (the "Software"), subject to the terms and
 *   conditions of the Sample Source Code License (SSCL) delivered
 *   with this Software. If you do not agree to the terms and
 *   conditions of the SSCL,
 *
 *     (i)  you must close this file and delete all copies of the
 *          Software, and
 *     (ii) any permission to use the Software is expressly denied.
 *
 */

package com.hds.hcp.apihelpers.query.result;

/**
 * This class represents an individual <code>resultSet</code> record for the <code>queryResult</code>
 * that is returned by an HCP query request. 
 * <p>
 * An object of this class may contain either default content or verbose content of the transaction record
 * as indicated by the {@link #isVerbose()} method.
 *
 * If the object does not contain a specific attribute, the getter method will return <code>null</code>.
 * <p>
 * The default transaction records consist of:
 * <ul>
 * <li> <code>version</code>
 * <li> <code>urlName</code>
 * <li> <code>operation</code> 
 * <li> <code>changeTimeMilliseconds</code>
 * </ul>
 * <p>
 * The class is constructed as a Bean to facilitate utilizing Jackson JSON 
 * serializer to create JSON formatted requests. The Jackson JSON component
 * will interpret the Bean format and populate this object when parsing the
 * stream.
 *
 * @version 5.0
 *
 */
public class ResultSetRecord {

	ResultSetRecord() { clearVerbose(); };
	
	public enum Operation { 
		/**
		 * Record represents an object CREATE transaction for a specific version.
		 */
		CREATED,
		/**
		 * Record represents an object DELETE transaction was performed.
		 */
		DELETED,
		/**
		 * Record indicates an object PURGE transaction was performed.
		 */
		PURGED,
		/**
		 * Record indicates an object DISPOSED transaction was performed.
		 */
		DISPOSED,
		/**
		 * Record indicates an object PRUNED transaction was performed.
		 */
		PRUNED
		};
		
	public enum ObjectType {
		/**
		 * Record represents a transaction on an HCP object.
		 */
		OBJECT
		};
	
	private Boolean _isVerbose;

	// Standard Content
	private Long _version;
	private String _urlName;
	private Operation _operation;
	private String _changeTimeMilliseconds;

	// Verbose Content
	private Long _accessTime;
	private String _accessTimeString;
	private Boolean _acl;
	private String _aclGrant;
	private String _changeTimeString;
	private Boolean _customMetadata;
	private Integer _dpl;
	private String _filePath;
	private Integer _gid;
	private String _hash;
	private String _hashScheme;
	private Boolean _hold;
	private Boolean _index;
	private Long _ingestTime;
	private String _ingestTimeString;
	private String _namespace;
	private String _owner;
	private Boolean _replicated;
	private Long _retention;
	private String _retentionClass;
	private String _retentionString;
	private Boolean _shred;
	private Long _size;
	private ObjectType _type;
	private Integer _uid;
	private Long _updateTime;
	private String _updateTimeString;
	private String _utf8Name;
	
	private void setVerbose() { _isVerbose = true; };
	private void clearVerbose() { _isVerbose = false; };
	
	/**
	 * Indicates whether this object has the full verbose content for the HCP transaction.
	 * <p>
	 * If the object is not verbose, it will only contain the <code>version</code>, <code>urlName</code>, <code>operation</code>, and <code>createTimeMilliseconds</code> values.
	 * </p>
	 * If the object is verbose, all the other fields that have setter/getter methods will have values.
	 * @return Boolean
	 */
	public Boolean isVerbose() { return _isVerbose; };

	////
	////  Setter methods
	////

	// Standard Content
	public void setVersion(Long inVersion) { _version = inVersion; };
	public void setUrlName(String inUrlName) { _urlName = inUrlName; };
	public void setOperation(Operation inOperation) { _operation = inOperation; };
	public void setChangeTimeMilliseconds(String inMilliseconds) { _changeTimeMilliseconds = inMilliseconds; };

	// Verbose 
	public void setAccessTime(Long inTime) { setVerbose(); _accessTime = inTime; };
	public void setAccessTimeString(String inTime) { setVerbose(); _accessTimeString = inTime; };
	public void setAcl(Boolean inAcl) { setVerbose(); _acl = inAcl; };
	public void setAclGrant(String inGrant) { setVerbose(); _aclGrant = inGrant; };
	public void setChangeTimeString(String inTime) { setVerbose(); _changeTimeString = inTime; };
	public void setCustomMetadata(Boolean inCustomMetadata) { setVerbose(); _customMetadata = inCustomMetadata; };
	public void setDPL(Integer inDPL) { setVerbose(); _dpl = inDPL; };
	public void setFilePath(String inPath) { setVerbose(); _filePath = inPath; };
	public void setGid(Integer inGid) { setVerbose(); _gid = inGid; };
	public void setHash(String inHash) { setVerbose(); _hash = inHash; };
	public void setHashScheme(String inHashScheme) { setVerbose(); _hashScheme = inHashScheme; };
	public void setHold(Boolean inHold) { setVerbose(); _hold = inHold; };
	public void setIndex(Boolean inIndex) { setVerbose(); _index = inIndex; };
	public void setIngestTime(Long inIngestTime) { setVerbose(); _ingestTime = inIngestTime; };
	public void setIngestTimeString(String inIngestTimeString) { setVerbose(); _ingestTimeString = inIngestTimeString; };
	public void setNamespace(String inNamespace) { setVerbose(); _namespace = inNamespace; };
	public void setOnwer(String inOwner) { setVerbose(); _owner = inOwner; };
	public void setReplicated(Boolean inReplicated) { setVerbose(); _replicated = inReplicated; };
	public void setRetention(Long inRetention) { setVerbose(); _retention = inRetention; };
	public void setRetetionClass(String inRetentionClass) { setVerbose(); _retentionClass = inRetentionClass; };
	public void setRetentionString(String inRetentionString) { setVerbose(); _retentionString = inRetentionString; };
	public void setShred(Boolean inShred) { setVerbose(); _shred = inShred; };
	public void setSize(Long inSize) { setVerbose(); _size = inSize; };
	public void setType(ObjectType inType) { setVerbose(); _type = inType; };
	public void setUid(Integer inUid) { setVerbose(); _uid = inUid; };
	public void setUpdateTime(Long inUpdateTime) { setVerbose(); _updateTime = inUpdateTime; };
	public void setUpdateTimeString(String inUpdateTimeString) { setVerbose(); _updateTimeString = inUpdateTimeString; };
	public void setUtf8Name(String inUtf8Name) { setVerbose(); _utf8Name = inUtf8Name; };

	////
	//// Getter Methods
	////
	
	// Standard Content
	public Long getVersion() { return _version; };
	public String getUrlName() { return _urlName; };
	public Operation getOperation() { return _operation; };
	public String getChangeTimeMilliseconds() { return _changeTimeMilliseconds; };

	// Verbose Content
	public Long getAccessTime() { return (isVerbose() ? _accessTime : null); };
	public String getAccessTimeString() { return (isVerbose() ? _accessTimeString : null); };
	public Boolean getAcl() { return (isVerbose() ? _acl : null); };
	public String getAclGrant() { return (isVerbose() ? _aclGrant : null); };
	public String getChangeTimeString() { return (isVerbose() ? _changeTimeString : null); };
	public Boolean getCustomMetadata() { return (isVerbose() ? _customMetadata : null); };
	public Integer getDPL() { return (isVerbose() ? _dpl : null); };
	public String getFilePath() { return (isVerbose() ? _filePath : null); };
	public Integer getGid() { return (isVerbose() ? _gid : null); };
	public String getHash() { return (isVerbose() ? _hash : null); };
	public String getHashScheme() { return (isVerbose() ? _hashScheme : null); };
	public Boolean getHold() { return (isVerbose() ? _hold : null); };
	public Boolean getIndex() { return (isVerbose() ? _index : null); };
	public Long getIngestTime() { return (isVerbose() ? _ingestTime : null); };
	public String getIngestTimeString() { return (isVerbose() ? _ingestTimeString : null); };
	public String getNamespace() { return (isVerbose() ? _namespace : null); };
	public String getOnwer() { return (isVerbose() ? _owner : null); };
	public Boolean getReplicated() { return (isVerbose() ? _replicated : null); };
	public Long getRetention() { return (isVerbose() ? _retention : null); };
	public String getRetentionClass() { return (isVerbose() ? _retentionClass : null); };
	public String getRetentionString() { return (isVerbose() ? _retentionString : null); };
	public Boolean getShred() { return (isVerbose() ? _shred : null); };
	public Long getSize() { return (isVerbose() ? _size : null); };
	public ObjectType getType() { return (isVerbose() ? _type : null); };
	public Integer getUid() { return (isVerbose() ? _uid : null); };
	public Long getUpdateTime() { return (isVerbose() ? _updateTime : null); };
	public String getUpdateTimeString() { return (isVerbose() ? _updateTimeString : null); };
	public String getUtf8Name() { return (isVerbose() ? _utf8Name : null); };
}
